<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>京东的某个商品的价格信息</title>
		<script src="js/jquery.min.js"></script>
	</head>
	<body>
		<div>
			商品编号: <span id="id"></span>
		</div>
		<div>
			商品价格: <span id="price"></span>
		</div>
	</body>
	<script>
		//1.实现写死的json字符串,解析展现到页面上
		var jsonstr = '[{"p":"17999.00","op":"17999.00","cbf":"0","id":"J_100010378153","m":"100000.00"}]';
		
		//2.获取价格和编号
		var obj = JSON.parse(jsonstr);//把字符串转换为js对象
		//获取数组的第一条记录,访问P属性
		var price = obj[0].p;
		var id = obj[0].id;
		
		console.log(price);
		console.log(id);
		
		//3.把内容写到页面进行展现
		$('#id').text(id);  //span标签属性写法
		$('#id').css('color','blue');
		$('#price').text(price).css('color','red');
		
		
	</script>
</html>
